package com.kaili.basic.service.impl;

import com.kaili.basic.pojo.entity.BaseNewsReplyVO;
import com.kaili.basic.mapper.BaseNewsReplyVOMapper;
import com.kaili.basic.service.NewsReplyService;
import com.kaili.common.util.LoginDetailUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Date;
import java.util.List;

/**
 * @author: dxj
 * @descrinption: Created by dxj on 18-7-2.
 * @modified:
 */
@Service
public class NewsReplyServiceImpl implements NewsReplyService {

    @Autowired
    private BaseNewsReplyVOMapper newsReplyVOMapper;


    @Override
    public boolean addNewsReply(BaseNewsReplyVO newsReply) {
        newsReply.setCreatedBy(LoginDetailUtils.getCurrentEmployeeId().longValue());
        newsReply.setCreatedTime(new Date());
        newsReply.setRdStatus(1);
        if (newsReplyVOMapper.addNewsReply(newsReply) > 0){
            return true;
        }else{
            return false;
        }

    }

    @Override
    public List<BaseNewsReplyVO> queryReplyByNewsId(Long newsId) {
        return newsReplyVOMapper.queryReplyByNewsId(newsId);
    }
}
